Skip to content

fix(pgpm): suppress stale update notification after pgpm update#749

Merged
pyramation merged 3 commits intomainfrom
devin/1772190611-fix-update-cache
Feb 27, 2026
Merged

fix(pgpm): suppress stale update notification after pgpm update#749
pyramation merged 3 commits intomainfrom
devin/1772190611-fix-update-cache

Conversation

@pyramation
Copy link
Contributor

@pyramation pyramation commented Feb 27, 2026

fix(pgpm): suppress stale update notification after pgpm update

Summary

After running pgpm update, subsequent commands incorrectly show "Update available: X -> Y" even though the update just completed successfully.

Root cause: pgpm update runs under the old binary. After npm install -g pgpm completes, the old binary calls clearUpdateCache('pgpm') which deletes the cache file. The next pgpm command (still resolving to the old binary path, e.g. due to mise reshim timing) finds no cache, fetches the latest version from npm, compares it against the stale pkgVersion from getPackageJson(__dirname), and shows a false-positive update notification.

Fix: Replace clearUpdateCache('pgpm') with the new suppressUpdateCheck('pgpm', pkgJson.version) from @inquirerer/utils@3.3.0. This writes a cache entry with latestVersion set to the current binary's version, so the next checkForUpdates call sees latestVersion === pkgVersionhasUpdate: false. The cache naturally expires after 24h, at which point a fresh check runs against the (by then correct) new binary.

Companion PR

The suppressUpdateCheck function was added in dev-utils#65, which has been merged and published as @inquirerer/utils@3.3.0.

Changes

  • pgpm/cli/src/commands/update.ts: swap clearUpdateCachesuppressUpdateCheck import and call
  • pgpm/cli/package.json: bump @inquirerer/utils from ^3.2.3 to ^3.3.0
  • pnpm-lock.yaml: resolve @inquirerer/utils@3.3.0 (plus pnpm formatting changes)

Review & Testing Checklist for Human

  • Manual test: Install an older pgpm version globally, run pgpm update, then immediately run pgpm package (or any other command) — the "Update available" message should no longer appear.
  • Verify lockfile: The lockfile diff is large due to pnpm reformatting. The only substantive change is @inquirerer/utils resolving to 3.3.0 (and its new transitive dep appstash@0.5.0). Confirm no unexpected dependency changes snuck in.
  • Edge case: If the cache write fails (e.g. permissions), suppressUpdateCheck falls back to clearUpdateCache, which re-exposes the original false-positive. Verify this fallback is acceptable.

Notes

After pgpm update installs a new version, the currently running binary
still reports the old version via getPackageJson(__dirname). Previously,
clearUpdateCache merely deleted the cache file, causing the next command
to fetch the latest from npm and compare against the stale pkgVersion,
producing a false-positive 'Update available' message.

Instead, write a cache entry with the current binary's version as
latestVersion so the next checkForUpdates call sees no update needed.
The cache expires after 24h, at which point a fresh check runs against
the (by then correct) new binary version.
@devin-ai-integration
Copy link
Contributor

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

Replace inline cache-writing logic with the new suppressUpdateCheck
export from @inquirerer/utils. This keeps the cache format knowledge
in one place (the utils package) rather than duplicating it.
@pyramation pyramation merged commit 86ec518 into main Feb 27, 2026
43 checks passed
@pyramation pyramation deleted the devin/1772190611-fix-update-cache branch February 27, 2026 20:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant